package www.test.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;



import www.test.bean.UserInfo;
import www.test.service.VerifyService;

public class VerifyServlet extends HttpServlet
{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	public UserInfo  domain = new UserInfo();

	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
	{
		try
		{
			domain.setUsername(request.getParameter("username"));
			domain.setPassword(request.getParameter("password"));
			boolean res = VerifyService.verify(request,response,domain);
			if(res)
			{
				response.sendRedirect(request.getContextPath()+"/servlet/InfoServlet");
				
			}
			
		}
		catch (SQLException e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		
	}

	
	public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
	{

		doGet(request, response);
		
	}


	

}
